<%@page import="com.qingke.pojo.Article"%>
<%@page import="java.util.List"%>
<%@page import="com.qingke.blog.Dao"%>
<%@page import="com.qingke.pojo.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Striped </title>
		<% String info =(String)session.getAttribute("articleerror");
			if(info==null){
				info="";
			}
			
			User user =(User)session.getAttribute("user");
			String display="";
			if(user==null){
				 display ="display:none";
			}
		%>
		<script src="js/jquery-1.8.3.min.js"></script>
		<script src="css/5grid/init.js?use=mobile,desktop,1200px,1000px&amp;mobileUI=1&amp;mobileUI.theme=none"></script>
		<script type="text/javascript">
			function login(){
				window.location.href="login.jsp";
			}
			function register(){
				window.location.href="register.jsp";
			}
			
			function clickSubmit(){
				var title = $("#title").val();
				var content = $("#textcontent").val();
				if(title == "" || content == ""){
					alert("标题和内容不能为空！");
					return false;
				}
				return true;
			}
		</script>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,700|Open+Sans+Condensed:300,700" rel="stylesheet" />
		
		<noscript>
			<link rel="stylesheet" href="css/5grid/core.css" />
			<link rel="stylesheet" href="css/5grid/core-desktop.css" />
			<link rel="stylesheet" href="css/5grid/core-1200px.css" />
			<link rel="stylesheet" href="css/5grid/core-noscript.css" />
			<link rel="stylesheet" href="css/style.css" />
			<link rel="stylesheet" href="css/style-desktop.css" />
			<link rel="stylesheet" href="css/style-1200px.css" />
		</noscript>
	</head>
	<body class="left-sidebar">

		<!-- Wrapper -->
        <div align=center>
<div style=“width:960px; margin:0 auto; height:90px;”>
<script>
(function() {
    var s = "_" + Math.random().toString(36).slice(2);
    document.write('<div id="' + s + '"></div>');
    (window.slotbydup=window.slotbydup || []).push({
        id: '730419',
        container: s,
        size: '960,90',
        display: 'inlay-fix'
    });
})();
</script>
</div>
</div>
			<div id="wrapper">

				<!-- Content -->
					<div id="content" class="mobileUI-main-content">
						<div id="content-inner">
						<div style="text-align: right;">
					<button onclick="login()">Login </button>
					<button onclick="register()">Register</button>
						
						</div>
							<!-- Post -->
							
								<article class="is-post is-post-excerpt">
									<%
										Dao dao =new Dao();
										List<Article> articles = dao.getAllArticles();
										request.setAttribute("articles", articles);
										for(Article article: articles){
									%>
											
									<header>
										
										<span class="byline"><%=article.getTitle() %></span>
									</header>
									
									<div class="info">
										<span class="date"><span class="month">Jan<span>uary</span></span> <span class="day">14</span><span class="year">, 2013</span></span>
										<ul class="stats">
											<li><a href="#" class="link-icon24 link-icon24-1">16</a></li>
											<li><a href="#" class="link-icon24 link-icon24-2">32</a></li>
											<li><a href="#" class="link-icon24 link-icon24-3">64</a></li>
											<li><a href="#" class="link-icon24 link-icon24-4">128</a></li>
										</ul>
									</div>
									<a href="#" class="image image-full"><img src="images/n33-robot-invader.jpg" alt="" /></a>
									<p>
										文章：<%=article.getContent() %><br>
										创建时间:<%=article.getCreatedAt() %><br>
										作者:<%=article.getUser().getUsername() %><br>
									</p>
									
										<%}
									%>
									
								</article>
						
							<!-- Post -->
								<article class="is-post is-post-excerpt">
									<header>
										<h2><a href="#">Lorem ipsum dolor sit amet</a></h2>
										<span class="byline">Feugiat interdum sed commodo ipsum consequat dolor nullam metus</span>
									</header>
									<div class="info">
										<span class="date"><span class="month">Jan<span>uary</span></span> <span class="day">8</span><span class="year">, 2013</span></span>
										<ul class="stats">
											<li><a href="#" class="link-icon24 link-icon24-1">12</a></li>
											<li><a href="#" class="link-icon24 link-icon24-2">24</a></li>
											<li><a href="#" class="link-icon24 link-icon24-3">48</a></li>
											<li><a href="#" class="link-icon24 link-icon24-4">96</a></li>
										</ul>
									</div>
									<a href="#" class="image image-full"><img src="images/fotogrph-dark-stairwell.jpg" alt="" /></a>
									<p>
										Quisque vel sapien sit amet tellus elementum ultricies. Nunc vel orci turpis. Donec id malesuada metus. 
										Nunc nulla velit, fermentum quis interdum quis, tate etiam commodo lorem ipsum dolor sit amet dolore. 
										Quisque vel sapien sit amet tellus elementum ultricies. Nunc vel orci turpis. Donec id malesuada metus. 
										Nunc nulla velit, fermentum quis interdum quis, convallis eu sapien. Integer sed ipsum ante.
									</p>
									<div style="<%=display %>">
									<form action="/Blog/publish" method="post"  onsubmit = "return clickSubmit();" >
										<input id="title" type="text" name="title" style="height:28px; font-size:24px;" placeholder="请输入文章名">
										<textarea id="textcontent" rows="25" cols="140" placeholder="内容" name="content"><%=info %></textarea>
										<input type ="submit" value="发布文章">
									</form>
									</div>
								</article>
						
							<!-- Pager -->
								<div class="pager">
									<!--<a href="#" class="button previous">Previous Page</a>-->
									<div class="pages">
										<a href="#" class="active">1</a>
										<a href="#">2</a>
										<a href="#">3</a>
										<a href="#">4</a>
										<span>&hellip;</span>
										<a href="#">20</a>
									</div>
									<a href="#" class="button next">Next Page</a>
								</div>

						</div>
					</div>

				<!-- Sidebar -->
					<div id="sidebar">
					
						<!-- Logo -->
							<div id="logo">
								<h1 class="mobileUI-site-name">STRIPED</h1>
							</div>
					
						<!-- Nav -->
							<nav id="nav" class="mobileUI-site-nav">
								<ul>
									<li class="current_page_item"><a href="#">Latest Post</a></li>
									<li><a href="#">Archives</a></li>
									<li><a href="#">About Me</a></li>
									<li><a href="#">Contact Me</a></li>
								</ul>
							</nav>

						<!-- Search -->
							<section class="is-search is-first">
								<form method="post" action="#">
									<input type="text" class="text" name="search" placeholder="Search" />
								</form>
							</section>
					
						<!-- Text -->
							<section class="is-text-style1">
								<div class="inner">
									<p>
									</p>
								</div>
							</section>
					
						<!-- Recent Posts -->
							<section class="is-recent-posts">
								<header>
									<h2>Recent Posts</h2>
								</header>
								<ul>
									<li><a href="#">Nothing happened</a></li>
									<li><a href="#">My Dearest Cthulhu</a></li>
									<li><a href="#">The Meme Meme</a></li>
									<li><a href="#">Now Full Cyborg</a></li>
									<li><a href="#">Temporal Flux</a></li>
								</ul>
							</section>
					
						<!-- Recent Comments -->
							<section class="is-recent-comments">
								<header>
									<h2>Recent Comments</h2>
								</header>
								<ul>
									<li>case on <a href="#">Now Full Cyborg</a></li>
									<li>molly on <a href="#">Untitled Post</a></li>
									<li>case on <a href="#">Temporal Flux</a></li>
								</ul>
							</section>
					
						<!-- Calendar -->
							<section class="is-calendar">
								<div class="inner">
									<table>
										<caption>February 2013</caption>
										<thead>
											<tr>
												<th scope="col" title="Monday">M</th>
												<th scope="col" title="Tuesday">T</th>
												<th scope="col" title="Wednesday">W</th>
												<th scope="col" title="Thursday">T</th>
												<th scope="col" title="Friday">F</th>
												<th scope="col" title="Saturday">S</th>
												<th scope="col" title="Sunday">S</th>
											</tr>
										</thead>
										<tbody>
											<tr>
												<td colspan="4" class="pad"><span>&nbsp;</span></td>
												<td><span>1</span></td>
												<td><span>2</span></td>
												<td><span>3</span></td>
											</tr>
											<tr>
												<td><span>4</span></td>
												<td><span>5</span></td>
												<td><a href="#">6</a></td>
												<td><span>7</span></td>
												<td><span>8</span></td>
												<td><span>9</span></td>
												<td><a href="#">10</a></td>
											</tr>
											<tr>
												<td><span>11</span></td>
												<td><span>12</span></td>
												<td><span>13</span></td>
												<td class="today"><a href="#">14</a></td>
												<td><span>15</span></td>
												<td><span>16</span></td>
												<td><span>17</span></td>
											</tr>
											<tr>
												<td><span>18</span></td>
												<td><span>19</span></td>
												<td><span>20</span></td>
												<td><span>21</span></td>
												<td><span>22</span></td>
												<td><a href="#">23</a></td>
												<td><span>24</span></td>
											</tr>
											<tr>
												<td><a href="#">25</a></td>
												<td><span>26</span></td>
												<td><span>27</span></td>
												<td><span>28</span></td>
												<td class="pad" colspan="3"><span>&nbsp;</span></td>
											</tr>
										</tbody>
									</table>
								</div>
							</section>

						<!-- Copyright -->
							<div id="copyright">
								<p>
									&copy; 2013 An Untitled Site <a target="_blank" href="http://www.huiyi8.com/moban/">网页模板</a>.
								</p>
							</div>
					
					</div>

			</div>

<div style="display:none"><script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540' language='JavaScript' charset='gb2312'></script></div>
</body>
</html>